﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using PGMHelper;
using Newtonsoft.Json;
using System.Windows.Forms.DataVisualization.Charting;

namespace Spectrum
{
    [JsonObject(MemberSerialization.OptIn)]
    /// <summary>
    /// 加速度激励时程
    /// </summary>
    public class AccelSet
    {
        #region Variables

        [JsonProperty]
        /// <summary>
        /// 初始的加速度时程曲线
        /// </summary>
        private List<AccelParam> OriginAccelList_ { set; get; }

        /// <summary>
        /// 目标时程曲线
        /// </summary>
        private List<AccelParam> TargetAccelList_ { set; get; }

        /// <summary>
        /// 目标加速度时间间隔
        /// </summary>
        private float TargetAccelTimeInterval { set; get; }

        /// <summary>
        /// 目标加速度时间最大值
        /// </summary>
        private float TargetAccelTimeLength { set; get; }

        #endregion

        #region Properties

        /// <summary>
        /// 获得时程最大时间
        /// </summary>
        public float OriginAccelMaxTime
        {
            get
            {
                if (this.OriginAccelList_.Count == 0) return 0;
                this.OriginAccelList_.OrderBy("Time");
                return this.OriginAccelList_.Last().Time;
            }
        }

        /// <summary>
        /// 原地震波峰值
        /// </summary>
        public float OriginAccelPGA
        {
            get
            {
                return this.PeakValue(MotionEnum.Accel);
            }
        }

        /// <summary>
        /// 原地震波峰值
        /// </summary>
        public float OriginPGV
        {
            get
            {
                return this.PeakValue(MotionEnum.Vel);
            }
        }

        /// <summary>
        /// 原地震波峰值
        /// </summary>
        public float OriginPGD
        {
            get
            {
                return this.PeakValue(MotionEnum.Disp);
            }
        }

        /// <summary>
        /// 地震波峰值对应的时刻
        /// </summary>
        public float OriginAccelPGATime
        {
            get
            {
                var accelMax = new float();
                var accleParam = new AccelParam();
                foreach (var accel in OriginAccelList_)
                {
                    if (Math.Abs(accel.Accel) >= accelMax)
                    {
                        accelMax = Math.Abs(accel.Accel);
                        accleParam = accel;
                    }
                }
                return accleParam.Time;
            }
        }

        /// <summary>
        /// 数据点数目
        /// </summary>
        public int Count
        {
            get
            {
                return this.OriginAccelList_.Count;
            }
        }

        /// <summary>
        /// 有效持续时间
        /// </summary>
        public float EffectiveDuration
        {
            get
            {
                //获得PGA
                var pga = this.OriginAccelPGA;
                //获得首次达到峰值10%的时刻
                var subPGA = 0.1F * pga;
                var Tstart = new float(); var Estart = new float();
                //往前遍历
                for (int index = 0; index < this.OriginAccelList_.Count; index++)
                {
                    if (Math.Abs(this.OriginAccelList_[index].Accel) >= subPGA)
                    {
                        Tstart = this.OriginAccelList_[index].Time; break;
                    }
                }
                //往后遍历
                for (int index = this.OriginAccelList_.Count - 1; index >= 0; index--)
                {
                    if (Math.Abs(this.OriginAccelList_[index].Accel) >= subPGA)
                    {
                        Estart = this.OriginAccelList_[index].Time; break;
                    }
                }
                //返回有效持时
                return Estart - Tstart;
            }
        }

        /// <summary>
        /// 返回原始加速度
        /// </summary>
        public List<AccelParam> OriginAccelList
        {
            get
            {
                return this.OriginAccelList_;
            }
        }

        /// <summary>
        /// 达5%Arias强度时刻
        /// </summary>
        public float t5
        {
            get
            {
                return this.GetAriasIntensityTime(0.05F);
            }
        }

        /// <summary>
        /// 达95%Arias强度时刻
        /// </summary>
        public float t95
        {
            get
            {
                return this.GetAriasIntensityTime(0.95F);
            }
        }

        /// <summary>
        /// 能量持时
        /// </summary>
        public float td
        {
            get
            {
                return this.t95 - this.t5;
            }
        }

        #endregion

        /// <summary>
        /// 激励峰值
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float PeakValue(MotionEnum motionEnum)
        {
            var valueList = this.GetOriginValueList(motionEnum.ToString());
            var min = valueList.Min();
            var max = valueList.Max();
            return Math.Max(Math.Abs(min), Math.Abs(max));
        }

        /// <summary>
        /// Housner能量
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float HousnerP(MotionEnum motionEnum, float t5, float t95)
        {
            return (this.GetOriginSquareEnergy(motionEnum, t5, t95)) / (t95 - t5);
        }

        /// <summary>
        /// Nau-Hall 平方
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float NauHallSquare(MotionEnum motionEnum)
        {
            return this.GetOriginSquareEnergy(motionEnum, 0, this.OriginAccelMaxTime);
        }

        /// <summary>
        /// Nau-Hall平方根
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float NauHallRS(MotionEnum motionEnum)
        {
            return (float)Math.Sqrt(this.NauHallSquare(motionEnum));
        }

        /// <summary>
        /// Housner均方根
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float HousnerRMS(MotionEnum motionEnum, float t5, float t95)
        {
            return (float)Math.Sqrt(this.HousnerP(motionEnum, t5, t95));
        }

        /// <summary>
        /// 累积绝对速度 位移 动力
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float AccumAbs(MotionEnum motionEnum)
        {
            return this.GetOriginAbsEnergy(motionEnum, 0, this.OriginAccelMaxTime);
        }

        /// <summary>
        /// 最大增量
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <returns></returns>
        public float MaxIncrementalValue(MotionEnum motionEnum, float t5, float t95)
        {
            //获得时间区间
            var timeList = this.GetZeroTimeList(motionEnum, t5, t95);
            //区间存在
            if (timeList.Count == 0) return 0F;
            //储存增量
            var incrementalList = new List<float>();
            //遍历时间区间
            for (int i = 1; i < timeList.Count; i++)
                incrementalList.Add(this.GetOriginAbsEnergy(motionEnum, timeList[i - 1], timeList[i]));
            return incrementalList.Max();
        }

        /// <summary>
        /// Park-Ang强度
        /// </summary>
        public float ParkIc(float t5, float t95)
        {
            return (float)(Math.Pow(this.HousnerRMS(MotionEnum.Accel, t5, t95), 1.5) * Math.Sqrt(t95 - t5));
        }

        /// <summary>
        /// Consenza强度
        /// </summary>
        public float ConsenzaIz(float t5, float t95)
        {
            return this.HousnerP(MotionEnum.Accel, t5, t95) / (this.OriginAccelPGA * this.OriginPGV);
        }

        /// <summary>
        /// Riddell加速度强度
        /// </summary>
        public float RiddellIra(float td)
        {
            return this.OriginAccelPGA * (float)Math.Pow(td, 0.333);
        }

        /// <summary>
        /// Riddell速度强度
        /// </summary>
        public float RiddellIrv(float td)
        {
            return (float)Math.Pow(this.OriginPGV, 0.667) * (float)Math.Pow(td, 0.333);
        }

        /// <summary>
        /// Riddell速度强度
        /// </summary>
        public float RiddellIrd(float td)
        {
            return (float)Math.Pow(this.OriginPGD, 1) * (float)Math.Pow(td, 0.333);
        }

        /// <summary>
        /// Fajfar速度强度
        /// </summary>
        public float FajfarIf(float td)
        {
            return (float)Math.Pow(this.OriginPGV, 1) * (float)Math.Pow(td, 0.25);
        }

        /// <summary>
        /// ChengYe速度强度
        /// </summary>
        public float ChengYeIcv(float td)
        {
            return (float)Math.Pow(this.OriginPGV, 1) * (float)Math.Pow(td, 0.15);
        }

        /// <summary>
        /// Arias强度
        /// </summary>
        public float AriasImTimeG(float t5, float t95)
        {
            return this.GetOriginSquareEnergy(MotionEnum.Accel, t5, t95)
                * (float)Math.PI / 2;
        }

        /// <summary>
        /// 修正的Arias强度
        /// </summary>
        public float ModifyAriasImaTimeG(float t5, float t95)
        {
            var vo = this.GetZeroTimeList(MotionEnum.Accel, t5, t95).Count / (t95 - t5);
            return this.AriasImTimeG(t5, t95) / (float)Math.Pow(vo, 2);
        }

        /// <summary>
        /// 过加速度零点的数据点
        /// </summary>
        /// <returns></returns>
        private List<float> GetZeroTimeList(MotionEnum motionEnum, float startTime, float endTime)
        {
            //初始化
            var timeList = new List<float>();
            //遍历时程
            for (int i = 1; i < this.OriginAccelList_.Count; i++)
            {
                //获得对象
                var param = this.OriginAccelList_[i];
                //时间越界
                if (param.Time > endTime) break;
                //满足时间要求
                if (param.Time < startTime) continue;
                //前一对象
                var paramI = this.OriginAccelList_[i - 1];
                //响应
                var valueJ = param.GetValue(motionEnum);
                var valueI = paramI.GetValue(motionEnum);
                //均为0
                if (valueJ == 0 && valueI == 0) continue;
                //反号
                if (valueI * valueJ <= 0) timeList.Add(param.Time);
            }
            return timeList;
        }

        /// <summary>
        /// 计算包围能量
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        private float GetOriginSquareEnergy(MotionEnum motionEnum, float startTime, float endTime)
        {
            //初始化
            var energy = 0F;
            //遍历时程
            for (int i = 1; i < this.OriginAccelList_.Count; i++)
            {
                //获得对象
                var param = this.OriginAccelList_[i];
                //时间越界
                if (param.Time > endTime) break;
                //满足时间要求
                if (param.Time < startTime) continue;
                //前一对象
                var paramI = this.OriginAccelList_[i - 1];
                //响应
                var valueJ = param.GetValue(motionEnum);
                var valueI = paramI.GetValue(motionEnum);
                //时间增量
                var dt = param.Time - paramI.Time;
                //判断是否同号
                if (valueJ * valueI < 0)
                {
                    var deltaDt = dt / (Math.Abs(valueJ) + Math.Abs(valueI));
                    var dtI = (float)(deltaDt * Math.Abs(valueI));
                    var dtJ = (float)(deltaDt * Math.Abs(valueJ));
                    energy += (float)(Math.Pow(valueJ, 2)) * 0.5F * dtI;
                    energy += (float)(Math.Pow(valueI, 2)) * 0.5F * dtJ;
                }
                else energy += (float)(Math.Pow(valueJ, 2) + Math.Pow(valueI, 2)) * 0.5F * dt;
            }
            return energy;
        }

        /// <summary>
        /// 计算包围能量
        /// </summary>
        /// <param name="motionEnum"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        private float GetOriginAbsEnergy(MotionEnum motionEnum, float startTime, float endTime)
        {
            //初始化
            var energy = 0F;
            //剔除前后多余的脉冲
            var removeEnergy = new List<float>();
            //遍历时程
            for (int i = 1; i < this.OriginAccelList_.Count; i++)
            {
                //获得对象
                var param = this.OriginAccelList_[i];
                //时间越界
                if (param.Time > endTime) break;
                //满足时间要求
                if (param.Time < startTime) continue;
                //前一对象
                var paramI = this.OriginAccelList_[i - 1];
                //响应
                var valueJ = param.GetValue(motionEnum);
                var valueI = paramI.GetValue(motionEnum);
                //时间增量
                var dt = param.Time - paramI.Time;
                //判断是否同号
                if(valueJ * valueI < 0)
                {
                    var deltaDt = dt / (Math.Abs(valueJ) + Math.Abs(valueI));
                    var dtI = (float)(deltaDt * Math.Abs(valueI));
                    var dtJ = (float)(deltaDt * Math.Abs(valueJ));
                    //两个三角形
                    var energyI = (float)(Math.Abs(valueI)) * 0.5F * dtI;
                    var energyJ = (float)(Math.Abs(valueJ)) * 0.5F * dtJ;
                    energy += (energyI + energyJ);
                    //添加脉冲
                    if (removeEnergy.Count == 0) removeEnergy.Add(energyI);
                    else removeEnergy.Add(energyJ);
                }
                else energy += (float)(Math.Abs(valueI) + Math.Abs(valueJ)) * dt * 0.5F;
            }
            //恰好为两个脉冲
            if (removeEnergy.Count == 2) removeEnergy.ForEach(val => energy -= val);
            return energy;
        }

        /// <summary>
        /// 计算达到Arias强度的时刻
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        private float GetAriasIntensityTime(float factor)
        {
            //总能量
            var totalEnergy = this.GetOriginSquareEnergy(MotionEnum.Accel, 0, this.OriginAccelMaxTime);
            //初始化
            var energy = 0F;
            //遍历时程
            for (int i = 1; i < this.OriginAccelList_.Count; i++)
            {
                //获得对象
                var param = this.OriginAccelList_[i];
                //前一对象
                var paramI = this.OriginAccelList_[i - 1];
                //计算能量
                var minerSqure = (float)(Math.Pow(paramI.GetValue(MotionEnum.Accel), 2) +
                    Math.Pow(param.GetValue(MotionEnum.Accel), 2));
                energy += minerSqure * (param.Time - paramI.Time) * 0.5F;
                //满足要求
                if (energy > totalEnergy * factor) return param.Time;
            }
            return this.OriginAccelMaxTime;
        }

        /// <summary>
        /// 设定地震波的位移和速度时程
        /// </summary>
        public void SetOriginVelDisp()
        {
            if(this.OriginAccelList_ != null)
            {
                for(int i = 1; i < this.OriginAccelList_.Count; i++)
                    this.OriginAccelList_[i].SetVelDisp(this.OriginAccelList_[i - 1]);
            }
        }

        /// <summary>
        /// 加速度调整
        /// </summary>
        /// <param name="factor"></param>
        public void AccelAmplitude(float factor)
        {
            this.OriginAccelList_.ForEach(param => param.Accel *= factor);
        }

        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="accelParam"></param>
        public void Add(AccelParam accelParam)
        {
            this.OriginAccelList_.Add(accelParam);
        }

        /// <summary>
        /// 系数初始加速度时程获得目标加速度时程
        /// </summary>
        public List<AccelParam> GetSpraseAccelHist(float dt, float length)
        {
            //响应是否为空
            //if (this.OriginAccelList_.Count == 0) return this.TargetAccelList_;
            //初始化
            this.TargetAccelTimeInterval = dt;
            this.TargetAccelTimeLength = length == -1 ? this.OriginAccelMaxTime :
                length;
            //决定数据点数据
            int StepNumber = (int)(this.TargetAccelTimeLength /
                this.TargetAccelTimeInterval) + 1;
            //初始加速度时程排序
            if(this.OriginAccelList_.Count != 0)
                this.OriginAccelList_.OrderBy(param => param.Time);
            //实例化
            this.TargetAccelList_ = new List<AccelParam>(StepNumber);
            //索引符号初始化(加速时程稀疏效果)
            int searchIndex = new int();
            //添加数据
            for (int step = 0; step < StepNumber; step++)
            {
                //确定时刻
                var time = step * this.TargetAccelTimeInterval;
                //判断是否越界
                if (searchIndex + 1 >= this.OriginAccelList_.Count)
                {
                    this.TargetAccelList_.Add(new AccelParam(time));
                    continue;
                }
                //记录前一步的值
                var preAccel = this.OriginAccelList_[searchIndex];
                var postAccel = this.OriginAccelList_[searchIndex + 1];
                //寻找区间
                while (time > postAccel.Time)
                {
                    //越界
                    if (++searchIndex + 1 >= this.OriginAccelList_.Count)
                        break;
                    //确定新的迭代参数
                    preAccel = postAccel;
                    postAccel = this.OriginAccelList_[searchIndex + 1];
                }
                //不越界直接进行线性插值
                this.TargetAccelList_.Add(preAccel.Interpolation(postAccel, time));
            }
            //设定地震波的位移和速度时程
            for (int i = 1; i < this.TargetAccelList_.Count; i++)
                this.TargetAccelList_[i].SetVelDisp(this.TargetAccelList_[i - 1]);
            return this.TargetAccelList_;
        }

        /// <summary>
        /// 获得值列表
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public List<float> GetOriginValueList(string propertyName)
        {
            return this.OriginAccelList_.GetPropertyList(propertyName).ConvertAll(f => (float)f);
        }

        /// <summary>
        /// 获得局部加速度
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        public AccelSet GetPartialAccel(int StartTime, int EndTime, float dt)
        {
            //初始化
            var accel = new AccelSet();
            this.OriginAccelList_.OrderBy("Time");
            //遍历时程
            this.OriginAccelList_.ForEach(accelParam =>
            {
                //时间范围内则添加
                if (accelParam.Time >= StartTime && accelParam.Time <= EndTime)
                    accel.Add(new AccelParam
                    {
                        Accel = accelParam.Accel,
                        Time = accel.Count * dt
                    });
            });
            //返回加速度时程
            return accel;
        }

        /// <summary>
        /// 根据加速度比值进行反应谱初选
        /// </summary>
        /// <param name="factor"></param>
        /// <returns></returns>
        public Tuple<int, int> GetBoundary(double factor)
        {
            //往前遍历
            int startTime = 0; int endTime = (int)this.OriginAccelList_.Last().Time;
            //获得GPA
            var pga = this.OriginAccelPGA;
            //遍历
            for (int index = 0; index < this.OriginAccelList_.Count; index++)
            {
                if(Math.Abs(this.OriginAccelList_[index].Accel) >= factor * pga)
                {
                    startTime = (int)this.OriginAccelList_[index == 0? 0: index - 1].Time;
                    break;
                }
            }
            //遍历
            for (int index = this.OriginAccelList_.Count - 1; index >= 0; index--)
            {
                if (Math.Abs(this.OriginAccelList_[index].Accel) >= factor * pga)
                {
                    endTime = (int)this.OriginAccelList_[index == this.OriginAccelList_.Count - 1? 
                        this.OriginAccelList_.Count - 1: index + 1].Time;
                    break;
                }
            }
            //返回
            return Tuple.Create<int, int>(startTime, endTime);
        }

        /// <summary>
        /// 绘制时程曲线
        /// </summary>
        /// <param name="chart"></param>
        public void ToChart(Chart chart)
        {
            this.ToChart(chart, MotionEnum.Accel);
        }

        /// <summary>
        /// 绘制时程曲线
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="motionEnum"></param>
        public void ToChart(Chart chart, MotionEnum motionEnum)
        {
            //绘图
            chart.Series.Clear();
            chart.AddSeries("地震波", SeriesChartType.Line, System.Drawing.Color.Black, 1);
            chart.Series["地震波"].Points.DataBindXY(this.GetOriginValueList("Time"),
               this.GetOriginValueList(motionEnum.ToString()));
            //值初始化
            var peak = this.PeakValue(motionEnum);
            var duration = this.OriginAccelMaxTime;
            //设定最大值
            var boundMax = peak * 2;
            //获得时间最大值
            var timeMax = duration <= 60 ? ((int)(duration / 10) + 1) * 10 :
                ((int)(duration / 20) + 1) * 20;
            chart.SetAxisBroundary(ChartAxisType.AxisX, 0, timeMax, 5);
            //设定最大值
            if (peak > 1)
            {
                //求得边界值
                boundMax = ((int)(peak / 10) + 1) * 10;
                //设定最大值
                chart.SetAxisBroundary(ChartAxisType.AxisY, (float)-boundMax, (float)boundMax, 4, 0);
            }
            else chart.SetAxisBroundary(ChartAxisType.AxisY, (float)-boundMax, (float)boundMax, 4);
        }

        /// <summary>
        /// 基线校正
        /// </summary>
        public void BaseLineCorrection()
        {
            ////获得最后时刻的位移
            //var disp = this.OriginAccelList_.Last().Disp;
            
            //var t = this.OriginAccelMaxTime;
            //var t5 = this.t5;
            ////初始化
            //var energy = 0F;
            ////遍历时程
            //for (int i = 1; i < this.OriginAccelList_.Count; i++)
            //{
            //    //获得对象
            //    var param = this.OriginAccelList_[i];
            //    //满足时间要求
            //    if (param.Time > t5) break;
            //    //前一对象
            //    var paramI = this.OriginAccelList_[i - 1];
            //    //计算包围面积
            //    energy += (param.Accel + paramI.Accel) * (param.Time - paramI.Time) * 0.5F;
            //}
            ////初始加速度
            //var deltaAccel = t5 == 0? 0: energy / t5;
            ////修改加速度
            //this.OriginAccelList_.ForEach(param => param.Accel -= deltaAccel);
            ////重设位移加速度
            //this.SetOriginVelDisp();
            ////获得最后时刻的偏移






            ////基本参数
            //var a1 = vel / (t * 2);
            ////修改加速度
            //this.OriginAccelList_.ForEach(param =>
            //param.Accel -= (float)(2 * a1));


            ////var a1 = (vel - 3 * disp / t) / Math.Pow(t, 3);
            ////var a2 = (disp - Math.Pow(t, 4) * a1) / Math.Pow(t, 3);
            ////var a2_sub = (vel -  4 * Math.Pow(t, 3) * a1) / (3  * Math.Pow(t, 2));
            //////修改加速度
            ////this.OriginAccelList_.ForEach(param =>
            ////param.Accel -= (float)(12 * a1 * Math.Pow(param.Time, 2) + 6 * a2 * param.Time));
            ////重设位移加速度
            //this.SetOriginVelDisp();
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public AccelSet()
        {
            this.OriginAccelList_ = new List<AccelParam>();
            this.TargetAccelList_ = new List<AccelParam>();
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="originAList"></param>
        /// <param name="dt"></param>
        /// <param name="length"></param>
        public AccelSet(List<AccelParam> originAList)
        {
            this.OriginAccelList_ = originAList;
            this.SetOriginVelDisp();
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="jumpLine"></param>
        /// <param name="linePrtNum"></param>
        /// <param name="dt"></param>
        public AccelSet(string filePath, int jumpLine, int linePrtNum, float dt)
        {
            //初始化
            this.OriginAccelList_ = new List<AccelParam>();
            //读取文件
            var strList = File.ReadAllLines(filePath).ToList();
            //跳过前方信息
            for(int index = jumpLine; index < strList.Count; index++)
            {
                //行信息为空时直接返回
                if (strList[index] == string.Empty) break;
                //拆分行信息
                var subStrList = WilsonHelper.SplitStr(strList[index]);
                //行信息是否匹配
                if (subStrList.Count < linePrtNum) break;
                //读取信息
                try
                {
                    for(int numIndex = 0; numIndex < linePrtNum; numIndex++)
                    {
                        this.OriginAccelList_.Add(new AccelParam
                        {
                            Time = this.OriginAccelList_.Count * dt,
                            Accel = Convert.ToSingle(subStrList[numIndex])
                        });
                    }
                }
                catch
                {
                    
                    break;
                }
            }
            this.SetOriginVelDisp();
        }

        /// <summary>
        /// 构造函数 time accel
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="jumpLine"></param>
        /// <param name="linePrtNum"></param>
        /// <param name="spilt"></param>
        public AccelSet(string filePath, int jumpLine, string spilt = ",")
        {
            //初始化
            this.OriginAccelList_ = new List<AccelParam>();
            //读取文件
            var strList = File.ReadAllLines(filePath).ToList();
            //跳过前方信息
            for (int index = jumpLine; index < strList.Count; index++)
            {
                //行信息为空时直接返回
                if (strList[index] == string.Empty) break;
                //拆分行信息
                var subStrList = WilsonHelper.SplitStr(strList[index], new string[] { spilt });
                //行信息是否匹配
                if (subStrList.Count < 2) break;
                //读取信息
                try
                {
                    this.OriginAccelList_.Add(new AccelParam
                    {
                        Time = Convert.ToSingle(subStrList[0]),
                        Accel = Convert.ToSingle(subStrList[1])
                    });
                }
                catch
                {
                    break;
                }
            }
            this.SetOriginVelDisp();
        }
    }
}
